/**
 * 
 */
package com.cwnuzj.ffms.ui.editor;

import java.util.List;

import com.cwnuzj.ffms.db.DbUtilsTemplate;
import com.cwnuzj.ffms.model.User;

/**
 * 家庭成员编辑器类
 * 
 * @author Jeff.Zheng
 * 
 */
public class UsersEditor extends TableViewerEditorPart {

	public static final String ID = "com.cwnuzj.ffms.users.editor";

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.cwnuzj.ffms.ui.editor.TableViewerEditorPart#getTitles()
	 */
	@Override
	public String[] getTitles() {
		String[] titles = { "ID", "用户名", "密码" };
		return titles;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.cwnuzj.ffms.ui.editor.TableViewerEditorPart#getFields()
	 */
	@Override
	public String[] getFields() {
		String[] fields = { "id", "username", "password" };
		return fields;
	}

	@Override
	public Object getTableViewerInput() {
		//获取数据库操作模板类
		DbUtilsTemplate template =  DbUtilsTemplate.getInstance();
		List<User> userList = template.find(User.class, "SELECT * from ffms.t_user");
		return userList;
	}

}
